package com.yy.jhl.ui.user.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yy.common.base.BaseActivity;
import com.yy.common.commonutils.ImageLoaderUtils;
import com.yy.common.commonutils.StringUtil;
import com.yy.common.commonwidget.OnDoubleClickListener;
import com.yy.common.commonwidget.OnNoDoubleClickListener;
import com.yy.jhl.R;
import com.yy.jhl.bean.LoginInfo;
import com.yy.jhl.interfaces.UserInfoCallBack;
import com.yy.jhl.util.DataRequestUtil;
import com.yy.jhl.util.DataUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by libingn on 2017/12/4.
 */

public class CompanyInfoActivity extends BaseActivity {
    @BindView(R.id.company_logo)
    ImageView companyLogo;
    @BindView(R.id.company_logo_parent)
    LinearLayout companyLogoParent;
    @BindView(R.id.company_name)
    TextView companyName;
    @BindView(R.id.company_name_parent)
    LinearLayout companyNameParent;
    @BindView(R.id.contact_person)
    TextView contactPerson;
    @BindView(R.id.contact_person_parent)
    LinearLayout contactPersonParent;
    @BindView(R.id.contact_phone)
    TextView contactPhone;
    @BindView(R.id.contact_phone_parent)
    LinearLayout contactPhoneParent;
    @BindView(R.id.contact_address)
    TextView contactAddress;
    @BindView(R.id.contact_address_parent)
    LinearLayout contactAddressParent;

    @Override
    public int getLayoutId() {
        return R.layout.act_company_info;
    }

    @Override
    public void initView() {
        showTitle("企业信息", new OnNoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                finish();
            }
        });
        showData();
    }
    private void showData(){
        LoginInfo.UserBean userInfo = DataUtil.getUserInfo(mContext);
        companyName.setText(userInfo.getCompany().getCompany_name());
        contactPerson.setText(userInfo.getCompany().getContact());
        contactPhone.setText(userInfo.getCompany().getContact_phone());
        contactAddress.setText(userInfo.getCompany().getAddress());
        if (!StringUtil.isEmpty(userInfo.getCompany().getLogo())){
            ImageLoaderUtils.displayRound(mContext,companyLogo,userInfo.getCompany().getLogo(),R.mipmap.gys_logo);
        }

    }
    @Override
    protected void onResume() {
        super.onResume();
        DataRequestUtil.getInstance(mContext).getUserInfo(new UserInfoCallBack() {
            @Override
            public void getCallBack(LoginInfo.UserBean userBean) {
                showData();
            }
        });
    }
    @OnClick({R.id.company_logo_parent, R.id.company_name_parent, R.id.contact_person_parent, R.id.contact_phone_parent, R.id.contact_address_parent})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.company_logo_parent:
                break;
            case R.id.company_name_parent:
                break;
            case R.id.contact_person_parent:
                break;
            case R.id.contact_phone_parent:
                break;
            case R.id.contact_address_parent:
                break;
        }
    }
}
